<include file="Couponorder:top" />
    <div data-role="header" data-position="fixed">
        <h1>{$sitename}</h1>
    </div>
	<div data-role="content">              
		<form method="post" data-transition="pop" id="verification" class="verification" name="verification" action="{:U('Couponorder/verification')}" enctype="multipart/form-data" >
		
			<div data-role="fieldcontain">
				<label for="number">礼卡卡号</label>
				<input type="text" name="number" id="number" value="" placeholder="请输入礼卡卡号" />
			</div>
			
			<div data-role="fieldcontain">
				<label for="password">礼卡密码</label>
				<input type="password" name="password" id="password" value="" placeholder="请输入礼卡密码" />
			</div>
			
		    <input type="button" name="submit" id="submitbtn" value="查 询"  />
		    <input type="hidden" name="search" value="1"  />
	
		</form>
	</div>
	<script>
	$(function(){
	   	$("#submitbtn").bind("click",function()
		{
	   		
	   		number = $("#number").val();
	   		password = $("#password").val();
	   		
	   		if(!number){
	   			alert('礼卡卡号不能为空！'); return false;
	   		}
	   		
	   		if(number.length < 8 || number.length > 14){
	   			alert('礼卡格式错误！'); return false;
	   		}
	   		
	   		if(!password){
	   			alert('密码不能为空！'); return false;
	   		}
	   		
	   		if(password.length < 6 || password.length > 10){
	   			alert('密码格式错误！'); return false;
	   		}

	   		var formData = $("#verification").serialize();
	   		
            $.ajax({
                type: "POST",
                url: "{:U('Couponorder/verification')}",
                cache: false,
                data: formData,
                dataType: "json",
                success: function(data){
                	if(data.status == 2){
                		//alert(data.info);
                		//setTimeout(function(){
                			window.location.href="{:U('Couponorder/myads')}"; 
        				//},1000);
					}else{
						alert(data.info);
					}
                },
                error: function(data){
                	alert('提交失败！');
                }
            });
	   		
            return false;
		});
	});
	</script>
	<div data-role="footer" data-position="fixed">
		<h6>© 诺亚阳湖大闸蟹提货官网</h6>
	</div>
<include file="Couponorder:bottom" />
